﻿using System;
using Cuce.ReportingServices.SSRSWS;
using NUnit.Framework;

namespace Cuce.ReportingServices.UnitTests
{
    /// <summary>
    /// ReportingServiceHelper Unit Test
    /// </summary>
    [TestFixture]
    public class ReportingServiceHelperUpdateTest
    {
        readonly IReportingService i = new Mock.ReportingServicesMock();

        /// <summary>
        /// Somes the test.
        /// </summary>
        [Test]
        public void ReportingServiceHelperWorkingTest()
        {
           
            var name = new ReportName("test", "/CRR/"); 
            var j = ReportingServiceHelper.UploadReport(i, name, "asdas");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper name null.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void ReportingServiceHelperNameNull()
        {
            
          
            var j = ReportingServiceHelper.UploadReport(i, null, "asdas");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper no folder.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void ReportingServiceHelperNoFolder()
        {
           
            var name = new ReportName("test", ""); 
            var j = ReportingServiceHelper.UploadReport(i, name, "asdas");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the name of the service helper no report.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void ReportingServiceHelperNoReportName()
        {
           
            var name = new ReportName("", "/CRR/"); 
            var j = ReportingServiceHelper.UploadReport(i, name, "asdas");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper no contents.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void ReportingServiceHelperNoContents()
        {
           
            var name = new ReportName("sss", "/CRR/"); 
            var j = ReportingServiceHelper.UploadReport(i, name, "");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper no RS.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ArgumentException))]
        public void ReportingServiceHelperNoRS()
        {
          
            var name = new ReportName("sss", "/CRR/"); 
            var j = ReportingServiceHelper.UploadReport(null, name, "fff");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper major error.
        /// </summary>
        [Test]
        [ExpectedException(typeof(ReportException))]
        public void ReportingServiceHelperMajorError()
        {
           
            var name = new ReportName("error", "/CRR/"); 
            var j = ReportingServiceHelper.UploadReport(i, name, "dfgsdf");

            Assert.IsNull(j);
        }

        /// <summary>
        /// Reportings the service helper major warning.
        /// </summary>
        [Test]
        public void ReportingServiceHelperMajorWarning()
        {
            

             
                var name = new ReportName("warning", "/CRR/"); 
                Warning[] j = ReportingServiceHelper.UploadReport(i, name, "sdfgsdf");

                Assert.IsTrue(j[0].Message == "warning");
            
        }

    }
}
